var app = getApp();

Page({
    data: {
        info: "",
        reason1: "",
        reason: "",
        showmodal: !1
    },
    TextArea: function(a) {
        var e = a.detail.value;
        this.setData({
            info: e
        });
    },
    onLoad: function(a) {
        app.look.navbar(this);
        var t = this;
        if (a.id) {
            var i = a.id;
            app.util.request({
                url: "entry/wxapp/my",
                data: {
                    op: "refund",
                    id: i
                },
                success: function(a) {
                    var e = a.data;
                    "1" == e.data.order.refund && wx.redirectTo({
                        url: "/xc_xinguwu/pages/refundDetail2/refundDetail2?id=" + i
                    }), console.log(e.data.order), e.data.order && t.setData({
                        order: e.data.order
                    }), e.data.refund && t.setData({
                        reason: e.data.refund
                    });
                }
            });
        }
    },
    open: function(a) {
        this.setData({
            showmodal: !0
        });
    },
    colse: function() {
        this.setData({
            showmodal: !1
        });
    },
    radioChange: function(a) {
        console.log("radio发生change事件，携带value值为：", a.detail.value);
        var e = a.detail.value;
        this.setData({
            reason1: e
        });
    },
    myform: function() {
        var a = this.data.order, e = this.data.reason1, t = this.data.info, i = a.id;
        wx.showLoading({
            title: "提交中"
        }), app.util.request({
            url: "entry/wxapp/my",
            data: {
                op: "save_refund",
                id: i,
                info: t,
                reason: e
            },
            success: function(e) {
                wx.hideLoading();
                var t = app.look.refunddy();
                0 < t.length ? wx.showModal({
                    title: "提交成功",
                    content: "退款申请提交成功，有结果通知我",
                    confirmText: "确认",
                    cancelText: "取消",
                    success: function(a) {
                        a.confirm ? app.look.requestSubscribeMessage(t, function(a) {
                            app.util.message({
                                title: e.data.message,
                                redirect: "redirect:../refundDetail2/refundDetail2?id=" + i
                            });
                        }) : app.util.message({
                            title: e.data.message,
                            redirect: "redirect:../refundDetail2/refundDetail2?id=" + i
                        });
                    }
                }) : app.util.message({
                    title: e.data.message,
                    redirect: "redirect:../refundDetail2/refundDetail2?id=" + i
                });
            }
        });
    },
    onReady: function() {
        app.look.navbar(this);
    }
});